home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / comstr.exe / TIMER.H < prev   
C/C++ Source or Header  |  1992-04-26  |  429b  |  33 lines

  1. #if !defined( __TIMER_H )
  2. #define __TIMER_H
  3.  
  4. class Timer
  5.     {
  6.     public:
  7.         Timer();
  8.  
  9.         void start();
  10.         unsigned long elapsed();
  11.  
  12.     protected:
  13.         unsigned long begin;
  14.         static volatile unsigned long far *timePtr;
  15.     };
  16.  
  17. inline Timer::Timer()
  18.     {
  19.     start();
  20.     }
  21.  
  22. inline void Timer::start()
  23.     {
  24.     begin = *timePtr;
  25.     }
  26.  
  27. inline unsigned long Timer::elapsed()
  28.     {
  29.     return (*timePtr - begin );
  30.     }
  31.  
  32. #endif    // __TIMER_H
  33.